<template>
  <div id="operatememberlist"> 


          <el-table :data="data" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
          :row-class-name="tableRowClassName"  :border="true">
 
                
    
                 <el-table-column label="时间"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.time }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="帐号"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.account }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="姓名"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="手机号"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.telphone }}</span>
                    </template>
                </el-table-column>

                 <el-table-column label="操作" align='center' width="250px" fixed="right">
                    <template slot-scope="scope"> 
                        <el-button size="mini"  type="primary"  plain @click="xg_but(scope.row)">修改</el-button> 
                        <el-button size="mini"  type="primary"  plain @click="delect_but(scope.row)">删除</el-button>
                        <el-button size="mini"  type="primary"  plain @click="xgpaw_but(scope.row)">密码</el-button>    
                    </template>
                </el-table-column>
  
            </el-table>  


            <!-- 修改 -->
        <el-dialog title="修改" :visible.sync="mtk1"  width="400px">
            <div style="width:100%;"> 

            <el-form ref="form"   label-width="100px" style="width:100%;">
                <!-- <el-form-item label="" label-width="0px" >
                    <el-input v-model="mtk1_form.account" placeholder="帐号"></el-input>
                </el-form-item>    -->
                 <el-form-item label="" label-width="0px" >
                    <el-input v-model="mtk1_form.nickname" placeholder="名称"></el-input>
                </el-form-item>  
                <el-form-item label="" label-width="0px" >
                    <el-input v-model="mtk1_form.telphone" placeholder="手机号"></el-input>
                </el-form-item>                                
            </el-form>

                <div style="text-align: center;width:50%;margin:auto;margin-top:30px;">
                    <el-button type="primary" style="width:100%;" class="custom_color_button" @click="xg_but_qr">确认</el-button>
                </div>

            </div> 
        </el-dialog>
       
          <!-- 修改密码 -->
        <el-dialog title="修改密码" :visible.sync="mtk2"  width="400px">
            <div style="width:100%;"> 

            <el-form ref="form"   label-width="100px" style="width:100%;">
                <el-form-item label="" label-width="0px" >
                    <el-input v-model="mtk2_form.password" placeholder="密码"></el-input>
                </el-form-item>                                  
            </el-form>

                <div style="text-align: center;width:50%;margin:auto;margin-top:30px;">
                    <el-button type="primary" style="width:100%;" class="custom_color_button" @click="xgpaw_but_qr">确认</el-button>
                </div>

            </div> 
        </el-dialog>
 


   </div>
</template>

<script>

export default {
   name: 'operatememberlist',
   props:{
      data:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
         mtk1:false,
        mtk1_form:{
          account:'',
          telphone:'',
          nickname:''
        },
        my_caid:'',
        mtk2:false,
        mtk2_form:{
          password:'',
        },
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 253
      
  },
  mounted (){

  },
  methods: {

       xg_but(row){  
          this.my_caid = row.caid
          this.mtk1_form.account = row.account
          this.mtk1_form.telphone = row.telphone
          this.mtk1_form.nickname = row.nickname
          this.mtk1 = true
      },
      xg_but_qr(){
          this.post("/operate_center/updateManager", {
              caid:this.my_caid,
              account:this.mtk1_form.account,
              nickname:this.mtk1_form.nickname,
              telphone:this.mtk1_form.telphone,
	         }).then(res => {

                 if(res.error_code == 0){
                    this.$emit('up_list_fun')
                    this.my_caid = ''
                    this.mtk1 = false
                     this.open1(res.result,'success')  //提示框
                }else {
                    this.open1(res.message,'warning')
                }


          })
     },
     xgpaw_but(row){
          this.mtk2_form.password = ''
          this.my_caid = row.caid
          this.mtk2 = true
     },
     xgpaw_but_qr(){
          this.post("/operate_center/updateManagerPwd", {
              caid:this.my_caid,
              password:this.mtk2_form.password,
	         }).then(res => {
               if(res.error_code == 0){
                    this.$emit('up_list_fun')
                    this.my_caid = ''
                    this.mtk2 = false
                    this.open1(res.result,'success')  //提示框
                }else {
                    this.open1(res.message,'warning')
                }
          })
     },
     delect_but(row){
          this.my_caid = row.caid
          this.$confirm('此操作将永久解冻用户, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {
                           
           this.post("/operate_center/delManager", {
              caid:this.my_caid,
	         }).then(res => {

                 if(res.error_code == 0){
                    this.$emit('up_list_fun')
                    this.open1(res.result,'success')  //提示框
                }else {
                    this.open1(res.message,'warning')
                }

            })

        }).catch(() => {
        //   this.$message({
        //     type: 'info',
        //     message: '已取消解冻'
        //   });          
        });

     },

  }
}
</script>


<style scoped>

</style>